package com.lelefly.base.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lelefly.base.model.Result;
import com.lelefly.base.po.FarmlandAccess;
import com.lelefly.base.serviceImp.FarmlandAccessService;

@Controller
@RequestMapping("/farminfo")
public class FarmlandAccessController extends BaseController{

	@Resource
	public FarmlandAccessService farmlandAccessService;
	
	

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/getFarmlandAccesss",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result getFarmlandAccesss(String usernm){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandAccessService.getFarmlandAccesss(usernm);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	
	
	@SuppressWarnings("rawtypes")
	@RequestMapping(value="/addFarmlandAccesss",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result addFarmlandAccess(FarmlandAccess farmlandAccess){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandAccessService.addFarmlandAccess(farmlandAccess);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	@SuppressWarnings("rawtypes")
	@RequestMapping(value="/updateFarmlandAccesss",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result updateFarmlandAccesss(FarmlandAccess farmlandAccess){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandAccessService.updateFarmlandInfo(farmlandAccess);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/delFarmlandAccesss",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result delFarmlandAccesss(String id){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandAccessService.delFarmlandAccess(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	
}
